<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>放生物种</title>

    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no, email=no" />


    <script type="text/javascript" src="{MODULE_URL}public/yu/js/flexible.js"></script>
    <script type="text/javascript" src="{MODULE_URL}public/yu/js/pageLoading.js"></script>
    <script type="text/javascript" src="{MODULE_URL}public/yu/js/jquery.js"></script>
    <script type="text/javascript" src="{MODULE_URL}public/yu/js/layer.js"></script>
    <link type="text/css" rel="stylesheet" href="{MODULE_URL}public/yu/css/release.css">

</head>

<body>
<!-- 一天放生一次后弹窗begin -->
<div class="indextip" id="indextip" style="display: none;">
    <div class="close_tan"></div>
    <div class="cont">
        感恩您的慈悲放生！您今天的放生次数已用完，望您明日继续来放生，解救众生性命，功德无量。
    </div>
</div>
<!-- 一天放生一次后弹窗end -->

<div class="loadDiv">

    <div class="loadContent"></div>
    <a href="javaScript:;" class="myBtn" id="myBtn">选择放生种类</a>
</div>

<div class="sortBg">
    <div class="close"></div>
    <div class="sort">
        <ul>
        {loop $list $v}
            <li><img src="../attachment/{$v['image']}" alt="{$v['title']}" data-cid="47"  data-qj="images/yu2.png" data-qlm="images/yu3.png" data-qrm="" data-price="0.00"/>
            <span></span><b>{$v['title']} {if $v['prise'] == '0.00'}免费{else}{$v['prise']}{/if}</b>
            </li>
        {/loop}
            
           
        </ul>
    </div>
</div>
<div class="numberBg">
    <a href="javaScript:;" class="return"></a>
    <div class="number">
        <div class="numberList">
            <img src="{MODULE_URL}public/yu/images/hong-r.png" alt="数量" data-qj="" data-qlm="" data-qrm="" data-price=""/>
            <span></span>
            <b>红鲤鱼</b>
        </div>
        <div class="numberPage">
            <span class="fangSpan">放生数量</span>
            <div class="Numsore">
                <div class="allNum"><i class="jian"></i><span class="inpNum">1</span><i class="add"></i></div>
            </div>
        </div>
        <a href="javaScript:;" class="btnOK" id="btnOK">确定</a>
        <input type="hidden" name="cid" id="cid" value="" />
    </div>
</div>

<div class="beginRelase">
    <div class="relaseAll">
        <div class="Reclose_A"><a href="javaScript:;" class="Relase_close" >X</a></div>
        <div class="Relase_cont">
        {$info['foyu']}
        </div>
    </div>
    <a href="javaScript:;" class="subRelase" id="subRelase">开始放生</a>
</div>

<!-- 会向功德 -->
<div class="releaseBack">
    <div class="BackAll">
        <div class="Back_A"><a href="javaScript:;" class="Back_close" >X</a></div>
        <div class="Back_cont">&nbsp;&nbsp;
        <span id="fs_tip">
        您已放生1天，还需连续放生6天即可上功德榜！</span>
        放生就是救命，放生就是延寿，将无尽功德回向给亲友，消灾免难。</div>
    </div>
    <a href="javaScript:;" class="subBack" id="subBack">回向功德</a>
</div>
<!-- 会向功德 -->
<!-- 回向内容 -->
<div class="releaseBack_OK">
    <div class="Back_OKAll">
        <a href="javaScript:;" class="Back_OK_close" >X</a>
        <div class="Back_OK_cont">
            <div class="backTitle">
                <span class="spanTiltle">善信佛子：</span>
               <span class="TiltleName">
                 <input type="text" value="" class="backInp1"/>
               </span>
                <div class="clear"></div>
                <div class="backContent">
                     <span class="spanContent">
                     愿以此功德，普及于一切。
                     我等与众生，皆共成佛道。
                     </span>
                </div>
            </div>
            <div class="backWho">
                <span class="spanWho">特别回向给：</span>
           <span class="whoName">
             <input type="text" value="" id="toname" class="backInp"/>
           </span>
            </div>
            <div class="backWish">
                <span class="spanWish">愿他（她）：</span>
           <span class="wishCont">
             <input type="text" value="" id="content" class="backInp"/>
           </span>
            </div>
        </div>
    </div>
    <a href="javaScript:;" class="subBack_OK" id="subBack_OK">确认回向</a>
</div>
<!-- 回向内容 -->
<!-- 提交后的内容 -->
<div class="releaseShare" style="display:none;">
    <div class="ShareAll">
        <a href="javaScript:;" class="Share_close" >X</a>
        <div class="Share_cont">
            <div class="backShare">
                <span class="spanShare">善信佛子：</span>
                <span class="shareNameInp"></span>
                <div class="clear"></div>
                <div class="shareContent">
             <span class="spanshareCont">
             愿以此功德，普及于一切。<br/>我等与众生，皆共成佛道。
             </span>
                </div>
            </div>
            <div class="shareWho">
                <span class="sharespanWho">特别回向给：</span>
                <span class="sharewhoInp"></span>
            </div>
            <div class="shareWish">
                <span class="shareWishHe">愿他（她）：</span>
                <span class="shareWishInp"></span>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <a href="javaScript:;" class="subShare" id="subShare">分享</a>
</div>
<!-- 提交后的内容 -->

<div class="fish">
    <div class="fishLeft fish1"></div>
    <div class="fishRight fish2"></div>
    <div class="fishLm fish3"></div>
    <div class="fishRm fish4"></div>
</div>
<div class="bubble"><p></p></div>

<div id="mask"></div>
<div id="mask2"></div>
<div id="mask3"></div>
<div id="share"></div>


<!-- 底部导航 -->
 {template 'yucommon/nav'}
<!-- 底部导航 -->


<script src="{MODULE_URL}public/yu/js/zepto.min.js"></script>
<script src="{MODULE_URL}public/yu/js/fun.js"></script>
<script type="text/javascript">

    $(window).on("load",function(e){
        e.preventDefault();
        $(".loadDiv").show();
        $("#mask").show();

    })

    $('.close_tan').on('tap', function(){
        $(this).parent().css('display', 'none');
    });

    $("#myBtn").on("click",function(e){
        var isFangsheng = '0';  	//今天是否放生
        if(parseInt(isFangsheng)){
            $(".loadDiv").hide();
            $("#mask").hide();
            $('#indextip').css('display', 'block');
        }else{
            e.preventDefault();
            $(".sortBg").show();
            $(".fish").css({'opacity':'1','display':'none'});
            $(".bubble").css({'opacity':'1','display':'none'});
            $(".loadDiv").hide();
        }
    });
    $(".sort ul li").on("click",function(){
        var srcId = $(this).find('img').attr("data-cid");

        var srcPath = $(this).find('img').attr("src");
        var srcLeft = $(this).find('img').attr("data-qj");
        var srclm = $(this).find('img').attr("data-qlm");
        var srcrm = $(this).find('img').attr("data-qrm");
        var price = $(this).find('img').attr("data-price");
        $(".numberList>img").attr("src",srcPath).attr("data-qj",srcLeft).attr("data-qlm",srclm).attr("data-qrm",srcrm).attr("data-price",price);
        var text = $(this).find('b').text();
        $(".numberList>b").text(text);
        $(".numberBg").show();
        $(".sortBg").hide();

        $('#cid').val(srcId);
    });
    $(".return").click(function(){
        $(".sortBg").show();
        $(".numberBg").hide();

    });
    $("i.jian").click(function(){ //减少数量
        var Num = $(".inpNum").text();
        if(Num>1){
            Num--;
            $(".inpNum").text(Num);
        }
    })
    $("i.add").click(function(){  //增加数量
        var Num = $(".inpNum").text();
        if(Num<10){
            Num++;
            $(".inpNum").text(Num);
        }
    })
    //确定条数后确认
    $("#btnOK").on("click",function(){ 
        $(".sortBg").hide();
        $("#mask2").show();
        $(".beginRelase").show();
        var dataLeft = $(".numberList>img").attr("src");
        var dataRight = $(".numberList>img").attr("data-qj");
        var dataLm = $(".numberList>img").attr("data-qlm");
        var dataRm = $(".numberList>img").attr("data-qrm");
        //alert(dataLeft+dataRight);
        $(".fishLeft").css('background-image','url('+dataLeft+')');
        $(".fishRight").css('background-image','url('+dataRight+')');
        $(".fishLm").css('background-image','url('+dataLm+')');
        $(".fishRm").css('background-image','url('+dataRm+')');

    })
    $(".close").click(function(){ //关闭种类弹窗
        $(".sortBg").hide();
        $("#mask").hide();
    });
    //确定条数后确认
//确认放生
    $("#subRelase").one("click",function(){   
        var cid = $('#cid').val();
        var num = parseInt($(".inpNum").text());
        var price=$(".numberList>img").attr("data-price");
        var totalprice=num*price;
            $(".fish").show();
            $(".bubble").show();
            $("#mask2").hide();
            $(".beginRelase").hide();
            $(".numberBg").hide();
            $("#mask").hide();
            //var NumOK = $(".inpNum").text();
            var NumOK = 15;
            $(".fish").css("animation-play-state","running");
            $(".fish").css("-webkit-animation-play-state","running");
            //$(".bubble>p").text("您已放生"+NumOK+rdata['message']['name']);
            $(".bubble>p").text("您已放生15");
            $(".fishLeft").css("animation-play-state","running");
            $(".fishLeft").css("-webkit-animation-play-state","running");
            $(".fishLm").css("animation-play-state","running");
            $(".fishLm").css("-webkit-animation-play-state","running");
            $(".fishRight").css("animation-play-state","running");
            $(".fishRight").css("-webkit-animation-play-state","running");
            $(".fishRm").css("animation-play-state","running");
            $(".fishRm").css("-webkit-animation-play-state","running");
            $(".bubble").css("animation-play-state","running");
            $(".bubble").css("-webkit-animation-play-state","running");
            setTimeout(blackTan,5000);


    })
    //确认放生 END

    function blackTan(){
        $(".releaseBack").show();
        $("#mask2").show();
        $(".fish").css('opacity','0');
        $(".bubble").css('opacity','0');

    }
    $("a.Relase_close").click(function(){  //默念弹窗关闭
        $("#mask2").hide();
        $(".beginRelase").hide();


    })
    $(".Back_close").on("click",function(){  
    //回向功能关闭
        $(".releaseBack").hide();
        $("#mask2").hide();
        $(".fish").css("animation-play-state","paused");
        $(".fish").css("-webkit-animation-play-state","paused");
        $(".fishLeft").css("animation-play-state","paused");
        $(".fishLeft").css("-webkit-animation-play-state","paused");
        $(".fishLm").css("animation-play-state","paused");
        $(".fishLm").css("-webkit-animation-play-state","paused");
        $(".fishRm").css("animation-play-state","paused");
        $(".fishRm").css("-webkit-animation-play-state","paused");
        $(".fishRight").css("animation-play-state","paused");
        $(".fishRight").css("-webkit-animation-play-state","paused");
        $(".bubble").css("animation-play-state","paused");
        $(".bubble").css("-webkit-animation-play-state","paused");
        $(".fish").hide();
        $(".bubble").hide();
    })
    $(".Back_OK_close").click(function(){  //确认回向关闭
        $("#mask2").hide();
        $(".releaseBack_OK").hide();
    })
    $(".Share_close").click(function(){
        $("#mask2").hide();
        $(".releaseShare").hide();
    })
    $("#subBack").click(function(){
        $(".releaseBack").hide();
        $(".releaseBack_OK").show();
    })
    //确认回向按钮
    $(".subBack_OK").on("click",function(){ 
        var nickname = $('.backInp1').val();
        var toname  = $.trim($('#toname').val());
        var content = $.trim($('#content').val());
        $.ajax({
            url:"{php echo $this->createMobileUrl('hui')}",
            type:"POST",
            dataType : 'json',
            data:{
                'name' : toname,
                'give' : content,
                'fozi' : nickname,
            },
            success: function(rdata){
                if(rdata.status == 1){
                    $(".subBack_OK").hide();
                    $(".releaseShare").show();
                    var title = $(".TiltleName>input").val();
                    var name = $(".whoName>input").val();
                    var content = $(".wishCont>input").val();
                    $(".shareNameInp").text(rdata.fozi);
                    $(".sharewhoInp").text(rdata.name);
                    $(".shareWishInp").text(rdata.give);

                }else if(rdata['message']['status']==2){
                    layer.msg(rdata['message']['msg']);
                }
            },
            error: function(data){
                
            }
        });


    });
    //确认回向按钮 END
    
    $("#subShare").click(function(){
        $(".releaseShare").hide();
        $("#share").show();
        $("#mask3").show();
        $("#mask2").hide();

    })
    $("#share").click(function(){
        $("#share").hide();
        $("#mask2").hide();
        $("#mask3").hide();
    })
</script>


</body>

</html>
